import request from '@/utils/request'

export function getBlog(page = 1, limit = 10) {
  return request({
    url: '/api/blog',
    method: 'get',
    params: {
      page,
      limit
    }
  })
}

export function deleteBlog(id) {
  return request({
    url: `/api/blog/${id}`,
    method: 'delete'
  })
}

export function addBlog(data){
  return request({
    url: '/api/blog',
    method: 'post',
    data
  })
}

export function editBlog(blogInfo){
  return request({
    url: `/api/blog/${blogInfo.id}`, 
    method: 'put',
    data: blogInfo.data
  });
}

export function findOneBlog(id){
  return request({
    url: `/api/blog/${id}`, 
    method: 'get'
  });
}
